package com.zzxx.mapper;

import com.zzxx.entity.Orders;
import com.zzxx.entity.OrdersExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

public interface OrdersMapper extends OrdersMapperEx{
    @SelectProvider(type=OrdersSqlProvider.class, method="countByExample")
    long countByExample(OrdersExample example);

    @DeleteProvider(type=OrdersSqlProvider.class, method="deleteByExample")
    int deleteByExample(OrdersExample example);

    @Delete({
        "delete from orders",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String id);

    @Insert({
        "insert into orders (id, bookerId, ",
        "bookTime, status, checkType, ",
        "introduce, objType, ",
        "ticketId, couponId, ",
        "createTime, managerId, ",
        "objId, qrsrc, hexhash, ",
        "contentType, price)",
        "values (#{id,jdbcType=VARCHAR}, #{bookerid,jdbcType=VARCHAR}, ",
        "#{booktime,jdbcType=DATE}, #{status,jdbcType=INTEGER}, #{checktype,jdbcType=INTEGER}, ",
        "#{introduce,jdbcType=VARCHAR}, #{objtype,jdbcType=INTEGER}, ",
        "#{ticketid,jdbcType=VARCHAR}, #{couponid,jdbcType=VARCHAR}, ",
        "#{createtime,jdbcType=TIMESTAMP}, #{managerid,jdbcType=VARCHAR}, ",
        "#{objid,jdbcType=VARCHAR}, #{qrsrc,jdbcType=VARCHAR}, #{hexhash,jdbcType=VARCHAR}, ",
        "#{contenttype,jdbcType=INTEGER}, #{price,jdbcType=DOUBLE})"
    })
    int insert(Orders row);

    @InsertProvider(type=OrdersSqlProvider.class, method="insertSelective")
    int insertSelective(Orders row);

    @SelectProvider(type=OrdersSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="bookerId", property="bookerid", jdbcType=JdbcType.VARCHAR),
        @Result(column="bookTime", property="booktime", jdbcType=JdbcType.DATE),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="checkType", property="checktype", jdbcType=JdbcType.INTEGER),
        @Result(column="introduce", property="introduce", jdbcType=JdbcType.VARCHAR),
        @Result(column="objType", property="objtype", jdbcType=JdbcType.INTEGER),
        @Result(column="ticketId", property="ticketid", jdbcType=JdbcType.VARCHAR),
        @Result(column="couponId", property="couponid", jdbcType=JdbcType.VARCHAR),
        @Result(column="createTime", property="createtime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="managerId", property="managerid", jdbcType=JdbcType.VARCHAR),
        @Result(column="objId", property="objid", jdbcType=JdbcType.VARCHAR),
        @Result(column="qrsrc", property="qrsrc", jdbcType=JdbcType.VARCHAR),
        @Result(column="hexhash", property="hexhash", jdbcType=JdbcType.VARCHAR),
        @Result(column="contentType", property="contenttype", jdbcType=JdbcType.INTEGER),
        @Result(column="price", property="price", jdbcType=JdbcType.DOUBLE)
    })
    List<Orders> selectByExample(OrdersExample example);

    @Select({
        "select",
        "id, bookerId, bookTime, status, checkType, introduce, objType, ticketId, couponId, ",
        "createTime, managerId, objId, qrsrc, hexhash, contentType, price",
        "from orders",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="bookerId", property="bookerid", jdbcType=JdbcType.VARCHAR),
        @Result(column="bookTime", property="booktime", jdbcType=JdbcType.DATE),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="checkType", property="checktype", jdbcType=JdbcType.INTEGER),
        @Result(column="introduce", property="introduce", jdbcType=JdbcType.VARCHAR),
        @Result(column="objType", property="objtype", jdbcType=JdbcType.INTEGER),
        @Result(column="ticketId", property="ticketid", jdbcType=JdbcType.VARCHAR),
        @Result(column="couponId", property="couponid", jdbcType=JdbcType.VARCHAR),
        @Result(column="createTime", property="createtime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="managerId", property="managerid", jdbcType=JdbcType.VARCHAR),
        @Result(column="objId", property="objid", jdbcType=JdbcType.VARCHAR),
        @Result(column="qrsrc", property="qrsrc", jdbcType=JdbcType.VARCHAR),
        @Result(column="hexhash", property="hexhash", jdbcType=JdbcType.VARCHAR),
        @Result(column="contentType", property="contenttype", jdbcType=JdbcType.INTEGER),
        @Result(column="price", property="price", jdbcType=JdbcType.DOUBLE)
    })
    Orders selectByPrimaryKey(String id);

    @UpdateProvider(type=OrdersSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("row") Orders row, @Param("example") OrdersExample example);

    @UpdateProvider(type=OrdersSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("row") Orders row, @Param("example") OrdersExample example);

    @UpdateProvider(type=OrdersSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Orders row);

    @Update({
        "update orders",
        "set bookerId = #{bookerid,jdbcType=VARCHAR},",
          "bookTime = #{booktime,jdbcType=DATE},",
          "status = #{status,jdbcType=INTEGER},",
          "checkType = #{checktype,jdbcType=INTEGER},",
          "introduce = #{introduce,jdbcType=VARCHAR},",
          "objType = #{objtype,jdbcType=INTEGER},",
          "ticketId = #{ticketid,jdbcType=VARCHAR},",
          "couponId = #{couponid,jdbcType=VARCHAR},",
          "createTime = #{createtime,jdbcType=TIMESTAMP},",
          "managerId = #{managerid,jdbcType=VARCHAR},",
          "objId = #{objid,jdbcType=VARCHAR},",
          "qrsrc = #{qrsrc,jdbcType=VARCHAR},",
          "hexhash = #{hexhash,jdbcType=VARCHAR},",
          "contentType = #{contenttype,jdbcType=INTEGER},",
          "price = #{price,jdbcType=DOUBLE}",
        "where id = #{id,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(Orders row);
}